package com.blog.zip.controller;

import com.blog.zip.bean.Article;
import com.blog.zip.bean.Product;
import com.blog.zip.bean.User;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

@RestController
public class TestController {
    @GetMapping("/test")
    public String insertUser() {
        return "hello world";
    }

    @PostMapping("/test/form")
    public Map testFormAction(Article article){
        System.out.println(article.getZid());
        Map<String,Object> map = new HashMap<>();
        map.put("code",200);
        map.put("msg","add success");
        return map;
    }

    @PostMapping("/test/json")
    public Map testJsonAction(@RequestBody Product product){
        System.out.println(product.getPid());
        Map<String,Object> map = new HashMap<>();
        map.put("code",200);
        map.put("msg","add success");
        return map;
    }

    @PostMapping("/test/trans")
    public Map testTransAction( Article article){
        System.out.println(article.getZid());
        Map<String,Object> map = new HashMap<>();
        map.put("code",200);
        map.put("msg","add success");
        return map;
    }

}
